<template>
  <div>
    <el-row>
      <el-col :span="24">
        <div class="grid-content bg-purple-dark">
          <el-table
              :data="tableData"
              highlight-current-row
              @current-change="handleCurrentChange"
              style="width: 100%">
            <el-table-column
                prop="cname"
                label="电影名"
                align="center">
            </el-table-column>
            <el-table-column
                prop="cmoney"
                label="价格"
                align="center">
            </el-table-column>
            <el-table-column
                prop="date"
                label="时间"
                align="center">
            </el-table-column>
            <el-table-column
                prop="number"
                label="操作"
                align="center">
              <template slot-scope="scope">
                <el-button plain
                           slot="reference"
                           type="primary" @click="handleChange(scope.row)">
                  出票
                </el-button>
              </template>
            </el-table-column>
          </el-table>
        </div>
      </el-col>
    </el-row>
  </div>
</template>

<script>
export default {
  name: "dianyingOrder",
  data() {
    return {
      tableData: ''
    }
  },
  mounted() {
    this.init()
  },
  methods: {
    init() {
      this.$axios.get("meituan/meituan/findByOrderAll").then(
          r => {
            let testDate = r.data;
            for (let i = 0; i < testDate.length; i++) {
              testDate[i].money = testDate[i].money + 100;
            }
            this.tableData = testDate;
          }
      )
    },
    handleChange(value) {
      console.log(value.cid)
      const h = this.$createElement;
      this.$axios.get("meituan/meituan/chupiao/" + value.id).then(
          r => {
            if ("修改成功" == r.data) {
              this.$notify({
                title: '提示',
                message: h('i', {style: 'color: teal'}, r.data)
              });
            } else {
              this.$notify({
                title: '提示',
                message: h('i', {style: 'color: teal'}, r.data)
              });
            }
          }
      )
    }
  }
}
</script>

<style scoped>

</style>